<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('POS绑定明细')" />
</head>
<body class="gray-bg">
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>终端号：</label>
                            <input type="text" name="bno"/>
                        </li>
                        <li>
                            <label>绑定ID：</label>
                            <input type="text" name="bid"/>
                        </li>
                        <li>
                            <label>是否绑定：</label>
                            <input type="text" oninput="value=value.replace(/[^\d]/g,'')" name="status"/>
                        </li>
                        <li>
                            <label>绑定类型：</label>
                            <input type="text" oninput="value=value.replace(/[^\d]/g,'')" name="type"/>
                        </li>
                        <li class="select-time">
                            <label style="width: 100px">绑定日期：</label>
                            <input type="text" class="time-input" id="startTime" th:value="${mindDate}"  placeholder="开始时间" name="mindDate"/>
                            <span>-</span>
                            <input type="text" class="time-input" id="endTime"  th:value="${maxDate}" placeholder="结束时间" name="maxDate"/>
                        </li>
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
        <div class="btn-group-sm" id="toolbar" role="group">
            <a class="btn btn-success" onclick="addPosBinding()" shiro:hasPermission="tBankinfo:tBankinfo:addPosBinding">
                <i class="fa fa-plus"></i> 添加
            </a>
        </div>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<div th:include="include :: footer"></div>
<script th:inline="javascript">
    var prefix = ctx + "tBankinfo/tBankinfo";
    var editFlag = [[${@permission.hasPermi('tBankinfo:tBankinfo:editPosBinding')}]];
    var removeFlag = [[${@permission.hasPermi('tBankinfo:tBankinfo:removePosBinding')}]];
    $(function()  {
        var options = {
            url: prefix + "/listPosBindingMap",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            clickToSelect:true,
            columns: [
                {
                    field : 'BID',
                    title : '绑定ID'
                },
                {
                    field : 'BNO',
                    title : '终端号'
                },
                {
                    field : 'STATUS',
                    title : '是否绑定'
                },
                {
                    field : 'TYPE',
                    title : '绑定类型'
                },
                {
                    field : 'ENTERING_TIME',
                    title : '创建时间'
                },
                {
                    field : 'ENTERING_MAN',
                    title : '创建人'
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="editPosBinding(\''+row.BNO+'\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="removePosBinding(\'' + row.BNO + '\')"><i class="fa fa-remove"></i>删除</a>');
                        return actions.join('');
                    }
                }
            ]
        };
        $.table.init(options);
    });
    function addPosBinding() {
        $.modal.open("新增POS绑定",prefix + "/addPosBinding/" ,'800');
    }

    function editPosBinding(bno) {
        $.modal.open("修改POS绑定",prefix + "/editPosBinding/"+bno ,'800');
    }

    function removePosBinding(bno) {
        $.modal.confirm("删除需谨慎，确定删除吗？", function() {
            $.operate.post(prefix + "/removePosBinding", { "bno": bno});
        })
    }

</script>
</body>
</html>